/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Nas
 */
@Entity
@Table(name = "HISTORIA_CLINICA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HistoriaClinica.findAll", query = "SELECT h FROM HistoriaClinica h"),
    @NamedQuery(name = "HistoriaClinica.findByIdEvaluMedica", query = "SELECT h FROM HistoriaClinica h WHERE h.idEvaluMedica = :idEvaluMedica"),
    @NamedQuery(name = "HistoriaClinica.findByIdAfiliado", query = "SELECT h FROM HistoriaClinica h WHERE h.idAfiliado = :idAfiliado"),
    @NamedQuery(name = "HistoriaClinica.findByDiagnostico", query = "SELECT h FROM HistoriaClinica h WHERE h.diagnostico = :diagnostico"),
    @NamedQuery(name = "HistoriaClinica.findByCreateBy", query = "SELECT h FROM HistoriaClinica h WHERE h.createBy = :createBy"),
    @NamedQuery(name = "HistoriaClinica.findByFechaCreate", query = "SELECT h FROM HistoriaClinica h WHERE h.fechaCreate = :fechaCreate"),
    @NamedQuery(name = "HistoriaClinica.findByModifiedBy", query = "SELECT h FROM HistoriaClinica h WHERE h.modifiedBy = :modifiedBy"),
    @NamedQuery(name = "HistoriaClinica.findByFechaModified", query = "SELECT h FROM HistoriaClinica h WHERE h.fechaModified = :fechaModified"),
    @NamedQuery(name = "HistoriaClinica.findByEstado", query = "SELECT h FROM HistoriaClinica h WHERE h.estado = :estado")})
public class HistoriaClinica implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_EVALU_MEDICA")
    private Integer idEvaluMedica;
    @Basic(optional = false)
    @Column(name = "ID_AFILIADO")
    private int idAfiliado;
    @Column(name = "DIAGNOSTICO")
    private String diagnostico;
    @Column(name = "CREATE_BY")
    private Integer createBy;
    @Column(name = "FECHA_CREATE")
    @Temporal(TemporalType.DATE)
    private Date fechaCreate;
    @Column(name = "MODIFIED_BY")
    private Integer modifiedBy;
    @Column(name = "FECHA_MODIFIED")
    private String fechaModified;
    @Column(name = "ESTADO")
    private String estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEvaluMedica")
    private List<EvaluacionAf> evaluacionAfList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEvaluMedica")
    private List<EvaluacionSv> evaluacionSvList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEvaluMedica")
    private List<EvaluacionMc> evaluacionMcList;

    public HistoriaClinica() {
    }

    public HistoriaClinica(Integer idEvaluMedica) {
        this.idEvaluMedica = idEvaluMedica;
    }

    public HistoriaClinica(Integer idEvaluMedica, int idAfiliado) {
        this.idEvaluMedica = idEvaluMedica;
        this.idAfiliado = idAfiliado;
    }

    public Integer getIdEvaluMedica() {
        return idEvaluMedica;
    }

    public void setIdEvaluMedica(Integer idEvaluMedica) {
        this.idEvaluMedica = idEvaluMedica;
    }

    public int getIdAfiliado() {
        return idAfiliado;
    }

    public void setIdAfiliado(int idAfiliado) {
        this.idAfiliado = idAfiliado;
    }

    public String getDiagnostico() {
        return diagnostico;
    }

    public void setDiagnostico(String diagnostico) {
        this.diagnostico = diagnostico;
    }

    public Integer getCreateBy() {
        return createBy;
    }

    public void setCreateBy(Integer createBy) {
        this.createBy = createBy;
    }

    public Date getFechaCreate() {
        return fechaCreate;
    }

    public void setFechaCreate(Date fechaCreate) {
        this.fechaCreate = fechaCreate;
    }

    public Integer getModifiedBy() {
        return modifiedBy;
    }

    public void setModifiedBy(Integer modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    public String getFechaModified() {
        return fechaModified;
    }

    public void setFechaModified(String fechaModified) {
        this.fechaModified = fechaModified;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    @XmlTransient
    public List<EvaluacionAf> getEvaluacionAfList() {
        return evaluacionAfList;
    }

    public void setEvaluacionAfList(List<EvaluacionAf> evaluacionAfList) {
        this.evaluacionAfList = evaluacionAfList;
    }

    @XmlTransient
    public List<EvaluacionSv> getEvaluacionSvList() {
        return evaluacionSvList;
    }

    public void setEvaluacionSvList(List<EvaluacionSv> evaluacionSvList) {
        this.evaluacionSvList = evaluacionSvList;
    }

    @XmlTransient
    public List<EvaluacionMc> getEvaluacionMcList() {
        return evaluacionMcList;
    }

    public void setEvaluacionMcList(List<EvaluacionMc> evaluacionMcList) {
        this.evaluacionMcList = evaluacionMcList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEvaluMedica != null ? idEvaluMedica.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistoriaClinica)) {
            return false;
        }
        HistoriaClinica other = (HistoriaClinica) object;
        if ((this.idEvaluMedica == null && other.idEvaluMedica != null) || (this.idEvaluMedica != null && !this.idEvaluMedica.equals(other.idEvaluMedica))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.HistoriaClinica[ idEvaluMedica=" + idEvaluMedica + " ]";
    }

}
